package com.efruit.poadapters;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.efruit.productInfoMag.IProductInfoFetcher;
import com.efruit.productInfoMag.ProductInfoMagFactory;

public class ProductInfoFactory extends ProductInfoMagFactory{

	private ProductInfoFetcherImpl productInfoFetcherImpl;
	
	@Override
	public IProductInfoFetcher getProductInfoFetcher() {
		System.out.println("get user info fetcher in factory impl");
		if (productInfoFetcherImpl == null) {
			System.out.println("create userinfofetcher");
			ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
			productInfoFetcherImpl = (ProductInfoFetcherImpl) ctx.getBean("ProductInfoFetcherImpl");
		}
		System.out.println("return userinfofetcher");
		return productInfoFetcherImpl;
	}

}
